﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace weclever.Infrastructure
{
    public class PageInfo
    {
        private List<string> picts = new List<string>();
        public string Name { get; set; }
        public string Title { get; set; }
        public string Price { get; set; }
        public string Discount { get; set; }
        public string Economy { get; set; }
        public string Bought { get; set; }
        public string Received { get; set; }
        public string Deadline { get; set; } //finish time
        public string ValidPeriod { get; set; } //
        public string Text { get; set; }
        public string ShortText { get; set; }
        public string Address { get; set; }
        public string Phone { get; set; }
        public string Pict { get; set; }
        public string Metro { get; set; }
        public string GPS { get; set; }
        public City CityName { get; set; }
        public string CityLat { get; set; }
        public string CityLon { get; set; }


        //public List<string> Pictures { get; set; }
        public List<string> GetPic()
        {
            return picts;
        }

        public void WriteToFile(string path)
        {
            using (StreamWriter sw = new StreamWriter(string.Format("{0}/{1}_{2}.txt", path, CityName.NameEng, Name)))
            {
                Type t = typeof(PageInfo);
                foreach (var p in t.GetProperties())
                {
                    sw.WriteLine(string.Format("{0}: {1}", p.Name, p.GetValue(this, null)));
                    sw.WriteLine("--------------------------------------------------------------");
                }
                int i = 0;
                foreach (var s in picts)
                {
                    i++;
                    sw.WriteLine(string.Format("Picture {0}: {1}", i, s));
                }
            }
        }

    }
}
